<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
model('jy_weishop/member')->checklogin();
if($_RQ['op']=='main'){
	//注册电商客会员
	$member=pdo_get('jy_weishop_member',array('merchid'=>$_SESSION['onemerchid'],'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$member['jiqiendtime1']=date('Y-m-d',$member['jiqiendtime']);
	$item=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','credit3','mobile','avatar','nickname'));
	$item=array_merge($item,$member);
	$item['id']=$_SESSION['uid'];
	$item['mycoupon']=pdo_count('jy_weishop_coupon_getlog',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'islock'=>0,'isuse'=>0));
	$item['level']=pdo_getcolumn('jy_weishop_member',array('merchid'=>$_SESSION['onemerchid'],'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'level');
	$item['level'] =pdo_getcolumn('jy_weishop_member_level',array('id'=>$item['level'],'uniacid'=>$_SESSION['uniacid']),'title');
	$item['level'] = $item['level']?$item['level']:'普通会员';
	$return['setting']=$return['pluginset'];
	$my_days = array(
				array('title'=>'我的优惠券','icon'=>'icon-youhuiquan','color'=>'#cc99ff','action'=>'jy_weishop/coupon.myindex/'),
				array('title'=>'微信会员卡','icon'=>'icon-daifahuo','color'=>'#cc99ff','action'=>'core/member.wxcard/main/'),
				//array('title'=>'余额提现','icon'=>'icon-dixiaofei','color'=>'#cc99ff','action'=>'core/member.tixian/'),
				array('title'=>'地址管理','icon'=>'icon-position','color'=>'#cc99ff','action'=>'core/member.address/'),
				array('title'=>'帮助中心','icon'=>'icon-help','color'=>'#cc99ff','action'=>'jy_weishop/news.list/'),
				//array('title'=>'获得购物卡','icon'=>'icon-qiangdan','color'=>'#cc99ff','action'=>'jy_weishop/member.getcard/'),
				//array('title'=>'我的购物车','icon'=>'icon-gouwuche','color'=>'#cc99ff','action'=>'jy_weishop/member.cart/'),
				//array('title'=>'我的购物卡','icon'=>'icon-pingzhengzhongxin','color'=>'#cc99ff','action'=>'jy_weishop/member.mycard/'),
				//array('title'=>'我的关注','icon'=>'icon-woguanzhudepinpai','color'=>'#cc99ff','action'=>'jy_weishop/member.favorite/'),
				//array('title'=>'我的足迹','icon'=>'icon-zuji','color'=>'#cc99ff','action'=>'jy_weishop/member.history/'),
	);
	$return['setting']['my_days'] = !empty($return['setting']['my_days']) ? $return['setting']['my_days'] : $my_days;
	$my_logs = array(
				array('title'=>'积分日志','icon'=>'icon-jifen','color'=>'#cc99ff','action'=>'core/member.credit_log/'),
				array('title'=>'余额日志','icon'=>'icon-jiangjiatongzhi','color'=>'#cc99ff','action'=>'core/member.credit_log/'),
				array('title'=>'提现日志','icon'=>'icon-trade','color'=>'#cc99ff','action'=>'core/member.cash_log/'),
				array('title'=>'红包日志','icon'=>'icon-ai-hongbao','color'=>'#cc99ff','action'=>'core/member.red_log/'),
	);
	$return['setting']['my_logs'] = !empty($return['setting']['my_logs']) ? $return['setting']['my_logs'] : $my_logs;
	$install = check_account_permission('jy_hehuofen');
	if($return['pluginset']['ishehuo'] && $install && $_SESSION['current_plugin'] !='jy_friends_shop'){
		$fenxiaoset=plugin('jy_hehuofen')->plugin_setting('page_setting');
		$my_memberbtn[]=array('action'=>'jy_hehuofen/index/','title'=>'合伙人入口','icon'=>'icon-paihao0','remark'=>'');
	}
	$return['setting']['my_memberbtn'] = !empty($return['setting']['my_memberbtn']) ? $return['setting']['my_memberbtn'] : $my_memberbtn;
	$return['item']=$item;
	$wxcard_setting=uni_setting('wx_card_setting');
	$wxcard_edit=uni_setting('wx_card_edit');

	if($wxcard_edit['card_id'] && $wxcard_edit['status']==1 && $wxcard_setting['open']){
		//存在会员卡且允许领取微信会员卡，检查是否已领卡
		$check=pdo_getcolumn('core_fans',array('openid'=>$_SESSION['openid'],'uniacid'=>$_SESSION['uniacid'],'wxgid'=>$_SESSION['wechat_id']),'wxcard_code');
		if(!$check){
			$wxcard=1;
		}
	}
	if(!$wxcard){
		array_splice($menu_list,3,1);
	}
	$sale_luck=plugin('jy_weishop')->plugin_setting('sale_luck');
	if($sale_luck['isopen']==1){
		$return['sale_luck']=model('jy_weishop/activity/sales')->getluck(true);
	}
	$return['closedsales']=1;
	$return['setpay']=uni_setting('pay');
	$return['menu_list']=$menu_list;
	$current_plugin=$_SESSION['current_plugin']?:'jy_baoming';
	$credit_types=credit_types();
	$return['credit3title']=$credit_types[3];
	set_html('title','会员中心');
	exi($return);
}
?>